package dk.simonvogensen.itodo.client.view;

import com.google.gwt.user.client.ui.*;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import dk.simonvogensen.uirecorder.client.RecordableVerticalPanel;
import dk.simonvogensen.uirecorder.client.RecordableTextArea;
import dk.simonvogensen.uirecorder.client.RecordableButton;
import dk.simonvogensen.itodo.client.controller.Controller;

/**
 * @author $LastChangedBy:$ $LastChangedDate:$
 * @version $Revision:$
 */
public class XmlWorktimeDialogBox extends DialogBox {

    public XmlWorktimeDialogBox(Controller controller) {
        super(false, false);
        setText("Worktime (xmlformat)");
        VerticalPanel panel = new RecordableVerticalPanel();

        String xml = controller.getXml();

        TextArea textArea = new RecordableTextArea();
        textArea.setText(xml);
        textArea.setSize("590px", "390px");

        panel.add(textArea);
        panel.setCellHorizontalAlignment(textArea, HorizontalPanel.ALIGN_CENTER);

        Button closeButton = new RecordableButton("Close", new ClickHandler() {
            public void onClick(ClickEvent event) {
                hide();
            }
        });
        panel.add(closeButton);
        panel.setCellHorizontalAlignment(closeButton, HorizontalPanel.ALIGN_CENTER);
        setWidget(panel);
        setSize("600px", "400px");
    }
}

